class TiledContainer extends Container {
Image background;
TiledContainer(Image image) {
setBackgroundImage(image);
}
public void setBackgroundImage(Image image) {
this.background = image;
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(background, 0);
// wait for the image to load
try { tracker.waitForAll(); } catch (Exception e) {}
}
public void update(Graphics g) {
paint(g);
}
|